// Player.cpp: implementation of the CPlayer class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "Client.h"
#include "Player.h"
#include "Global.h"

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

CPlayer::CPlayer()
{
	Clear();
	ServPNum = 0;
	PNum = 0;
}

CPlayer::~CPlayer()
{
}

void CPlayer::Clear()
{
	ZeroMemory(&UI, sizeof(UI));
	bReserveReady = FALSE;
	bShutMouse = FALSE;
	Team = 0;
	TeamPos = 0;
	SelTankKind = 0;
	Reset();


	ZeroMemory( m_cCommandSelTankKind, sizeof(char) * MAX_COMMAND_MODE_TANKNUM);
	ZeroMemory( m_cTankIndex, sizeof(char) * MAX_COMMAND_MODE_TANKNUM);	
}

void CPlayer::SetPlayerNum(int pnum)
{
	PNum = pnum;
}

void CPlayer::SetNewPlayer(USERINFO *pUI)
{
	Clear();
	memcpy(&UI, pUI, sizeof(USERINFO));
	Avatar.SetAvatar(UI.AvatarInfo);
}

void CPlayer::Reset()
{
	bNowWinner = FALSE;
	bReady = FALSE;

	JoinState = 0;
	PlayState = 0;
	TankKind = 0;
	TurnRate = 0;
}